home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 60914 / 60914.xpi / chrome / content / options.js < prev    next >
Text File  |  2010-01-20  |  4KB  |  124 lines

  1.         
  2.  
  3.     PersonasRotatorOptions = {
  4.             
  5.         load : function (event){
  6.  
  7.             var showpersonasrotatortabnormalcontextcheckbox=document.getElementById("showpersonasrotatortabnormalcontextcheckbox");
  8.             var prefilluploadformcheckbox=document.getElementById("prefilluploadformcheckbox");
  9.             var logalertenabledcheckbox=document.getElementById("logalertenabledcheckbox");
  10.         
  11.             var personasrotatorprefsinstance = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  12.  
  13.             var showpersonasrotatortabnormalcontext = personasrotatorprefsinstance.getBoolPref("extensions.personasrotator.showpersonasrotatortabnormalcontext");
  14.             var prefilluploadform = personasrotatorprefsinstance.getBoolPref("extensions.personasrotator.prefilluploadform");
  15.             var logalertenabled = personasrotatorprefsinstance.getBoolPref("extensions.personasrotator.logalertenabled");
  16.             
  17.             if(showpersonasrotatortabnormalcontext){
  18.             
  19.                 showpersonasrotatortabnormalcontextcheckbox.setAttribute("class","enabled");
  20.                 showpersonasrotatortabnormalcontextcheckbox.setAttribute("checked","true");
  21.             
  22.             }
  23.             
  24.             else {
  25.             
  26.                 showpersonasrotatortabnormalcontextcheckbox.setAttribute("class","disabled");
  27.                 showpersonasrotatortabnormalcontextcheckbox.setAttribute("checked","false");
  28.                 
  29.             }
  30.             
  31.             if(prefilluploadform){
  32.             
  33.                 prefilluploadformcheckbox.setAttribute("class","enabled");
  34.                 prefilluploadformcheckbox.setAttribute("checked","true");
  35.             
  36.             }
  37.             
  38.             else {
  39.             
  40.                 prefilluploadformcheckbox.setAttribute("class","disabled");
  41.                 prefilluploadformcheckbox.setAttribute("checked","false");
  42.                 
  43.             }
  44.  
  45.             
  46.             if(logalertenabled){
  47.             
  48.                 logalertenabledcheckbox.setAttribute("class","enabled");
  49.                 logalertenabledcheckbox.setAttribute("checked","true");
  50.             
  51.             }
  52.             
  53.             else {
  54.             
  55.                 logalertenabledcheckbox.setAttribute("class","disabled");
  56.                 logalertenabledcheckbox.setAttribute("checked","false");
  57.                 
  58.             }
  59.  
  60.  
  61.             showpersonasrotatortabnormalcontextcheckbox.addEventListener("command",PersonasRotatorOptions.showpersonasrotatortabnormalcontextcheckboxOncommandHandler,false);
  62.             prefilluploadformcheckbox.addEventListener("command",PersonasRotatorOptions.prefilluploadformcheckboxOncommandHandler,false);
  63.             logalertenabledcheckbox.addEventListener("command",PersonasRotatorOptions.logalertenabledcheckboxOncommandHandler,false);
  64.  
  65.             
  66.         },
  67.  
  68.         showpersonasrotatortabnormalcontextcheckboxOncommandHandler : function (event){
  69.             
  70.             var personasrotatorprefsinstance = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  71.  
  72.             if (event.target.getAttribute("class")=="enabled") {
  73.                 
  74.                 event.target.setAttribute("class","disabled");
  75.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.showpersonasrotatortabnormalcontext", false);    
  76.             
  77.             } else {
  78.             
  79.                 event.target.setAttribute("class","enabled");
  80.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.showpersonasrotatortabnormalcontext", true);    
  81.             
  82.             }
  83.  
  84.         },
  85.  
  86.         prefilluploadformcheckboxOncommandHandler : function (event){
  87.             
  88.             var personasrotatorprefsinstance = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  89.  
  90.             if (event.target.getAttribute("class")=="enabled") {
  91.                 
  92.                 event.target.setAttribute("class","disabled");
  93.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.prefilluploadform", false);    
  94.             
  95.             } else {
  96.             
  97.                 event.target.setAttribute("class","enabled");
  98.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.prefilluploadform", true);    
  99.             
  100.             }
  101.  
  102.         },
  103.  
  104.         logalertenabledcheckboxOncommandHandler : function (event){
  105.             
  106.             var personasrotatorprefsinstance = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  107.  
  108.             if (event.target.getAttribute("class")=="enabled") {
  109.                 
  110.                 event.target.setAttribute("class","disabled");
  111.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.logalertenabled", false);    
  112.             
  113.             } else {
  114.             
  115.                 event.target.setAttribute("class","enabled");
  116.                 personasrotatorprefsinstance.setBoolPref("extensions.personasrotator.logalertenabled", true);    
  117.             
  118.             }
  119.  
  120.         },
  121.     
  122.     }
  123.  
  124.     window.addEventListener("load",PersonasRotatorOptions.load,false);